package com.chixing.day12.Pointer;



public class GenericDemo {
    public static void fun1(PointerDemo<Integer> pointerDemo){}
    public static void fun2(PointerDemo<String> pointerDemo){}

       //？通配符:可以匹配任意的 泛型类型
    public static void fun3(PointerDemo<?> pointerDemo){}

    // ? extends:通配符加了上限
    public static void fun4(PointerDemo <? extends Account> pointerDemo){}

    // <F>作用域 仅在该方法中
    public <F> void fun5(F a){
        return;
    }

    public static void main(String[] args) {
        PointerDemo<Account> pot1 = new PointerDemo<>();
        PointerDemo<CreditAccount> pot2 = new PointerDemo<>();
        PointerDemo<pointAccount> pot3 = new PointerDemo<>();
        fun4(pot1);
        fun4(pot2);
        fun4(pot3);


        PointerDemo<Integer> p1 = new PointerDemo<Integer>();
        fun1(p1);

        PointerDemo<String> p2 = new PointerDemo<>();
        fun2(p2);


        fun3(p1);
        fun3(p2);
        PointerDemo<Float> p3 = new PointerDemo<>();
        fun3(p3);

        PointerDemo<Account> p4 = new PointerDemo<>();
        fun3(p4);

        A<Account> a = new A();
        A<CreditAccount> b = new A();
        A<pointAccount> c = new A();

    }

}

class Account{}
class CreditAccount extends Account {}
class pointAccount extends Account {}

class A <T extends Account>{

}

